<?php

class ACatalogModule extends AWebModule
{
	public function init()
	{
		// this method is called when the module is being created
		// you may place code here to customize the module or the application

		// import the module-level models and components
		$this->setImport(array(
			'ACatalog.models.*',
			'ACatalog.components.*',
		));


		$theme = 'adminArea'.DIRECTORY_SEPARATOR.'classic';
		Yii::app()->setTheme($theme);
		$this->setViewPath(Yii::app()->getTheme()->viewPath.DIRECTORY_SEPARATOR.$this->name);
	}

	public function beforeControllerAction($controller, $action)
	{
		if(parent::beforeControllerAction($controller, $action))
		{
			// this method is called before any module controller action is performed
			// you may place customized code here
			return true;
		}
		else
			return false;
	}

	public static function getMenuConfig(){
		return array(
			'name'=>'Каталог',
			'sub'=>array(
				array(
					'name'=>'Товары',
					'sub'=>array(
						array(
							'name'=>'Список товаров',
							'url'=>'/adminArea/ACatalog/item/list',
						),
						array(
							'name'=>'Добавить товар',
							'url'=>'/adminArea/ACatalog/item/update/id/0',
						),
					),
				),
				array(
					'name'=>'Категории',
					'sub'=>array(
						array(
							'name'=>'Список категорий',
							'url'=>'/adminArea/ACatalog/category/list',
						),
						array(
							'name'=>'Добавить категорию',
							'url'=>'/adminArea/ACatalog/category/update/id/0',
						),
					),
				),
				array(
					'name'=>'Параметры',
					'sub'=>array(
						array(
							'name'=>'Список',
							'url'=>'/adminArea/ACatalog/parameter/list',
						),
						array(
							'name'=>'Добавить',
							'url'=>'/adminArea/ACatalog/parameter/update/id/0',
						),
					),
				),
				array(
					'name'=>'Производители',
					'sub'=>array(
						array(
							'name'=>'Список',
							'url'=>'/adminArea/ACatalog/manufacturer/list',
						),
						array(
							'name'=>'Добавить',
							'url'=>'/adminArea/ACatalog/manufacturer/update/id/0',
						),
					),
				),
			)
		);
	}
}
